package bb.lanxing.model;

import android.text.TextUtils;

import com.umeng.analytics.pro.z;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;

import bb.lanxing.model.json.ServerUser;
import bb.lanxing.util.JsonUtil;
import bb.lanxing.utils.DateUtil;

public class Comment implements Serializable {
    private static final long serialVersionUID = 1;
    private String content;
    private long createTime;
    private long informedUserId;
    private String informedUserName;
    private double latitude;
    private double longitude;
    private String photoUrl;
    private int serverId;
    private ServerUser serverUser;
    private long topic;

    public Comment() {
    }

    public Comment(JSONObject jSONObject) throws JSONException {
        setServerId(jSONObject.getInt("id"));
        setContent(jSONObject.getString("content"));
        setLatitude(jSONObject.getDouble("latitude"));
        setLongitude(jSONObject.getDouble("longitude"));
        setCreateTime(jSONObject.getString("create_time"));
        setPhotoUrl(jSONObject.getString("pic_url"));
        setServerUser(new ServerUser(jSONObject.getJSONObject("user")));
        String string = jSONObject.getString("informed_user_id");
        if (!TextUtils.isEmpty(string)) {
            setInformedUserId(Long.parseLong(string));
        }
        try {
            setInformedUserName(jSONObject.getString("informed_username"));
        } catch (Exception unused) {
            setInformedUserName(jSONObject.getString("informed_user"));
        }
        long longValue = JsonUtil.getLongValue("topic", jSONObject);
        if (longValue > 0) {
            setTopic(longValue);
        }
    }

    public void setPhotoUrl(String str) {
        this.photoUrl = str;
    }

    public String getPhotoUrl() {
        return this.photoUrl;
    }

    public int getServerId() {
        return this.serverId;
    }

    public void setServerId(int i) {
        this.serverId = i;
    }

    public ServerUser getServerUser() {
        return this.serverUser;
    }

    public void setServerUser(ServerUser serverUser) {
        this.serverUser = serverUser;
    }

    public long getTopic() {
        return this.topic;
    }

    public void setTopic(long j) {
        this.topic = j;
    }

    public String getContent() {
        return this.content;
    }

    public void setContent(String str) {
        this.content = str;
    }

    public double getLatitude() {
        return this.latitude;
    }

    public void setLatitude(double d) {
        this.latitude = d;
    }

    public double getLongitude() {
        return this.longitude;
    }

    public void setLongitude(double d) {
        this.longitude = d;
    }

    public long getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(long j) {
        this.createTime = j;
    }

    public void setCreateTime(String str) {
        this.createTime = DateUtil.parse(str, 3);
    }

    public long getInformedUserId() {
        return this.informedUserId;
    }

    public void setInformedUserId(long j) {
        this.informedUserId = j;
    }

    public String getInformedUserName() {
        return this.informedUserName;
    }

    public void setInformedUserName(String str) {
        this.informedUserName = str;
    }
}
